package com.zxq.tcp.handler.dispatch;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public abstract class HandlerDispatch implements IHandlerDispatch {

    public HandlerDispatch next = null;

    protected ByteBuf in;
    protected ChannelHandlerContext channel;
    public void injectByteBuf(ChannelHandlerContext channel,ByteBuf in) {
        this.in = in;
        this.channel = channel;
    }

    public final void handlerFrame() {

        if(isThisFrame()) {
            decodeFrame();
        } else if(next != null) {
            next.handlerFrame();
        } else {
            log.info("not find this com.zxq.common.handler");
        }

    }



}
